// 处理接口

import {pb} from "db://assets/script/network/ws/proto";
import {Long} from "protobufjs";

// 从牌中filter最后拿到的牌
export function getNewTakeTileFromDuanPai(dp: pb.IDuanPaiInfo[], myShortId: number | Long): pb.ITileInfo | null {
    let newTakeTile = null
    for (const info of dp) {
        if (info.shortId === myShortId) {
            // 是轮到自己出牌
            newTakeTile = info.allCards[info.allCards.length - 1]
            info.allCards.splice(info.allCards.length - 1, 1)
            break
        }
    }
    return newTakeTile
}
